import Vue from "vue";
import VueRouter from "vue-router";
// import { component } from "vue/types/umd";
import HomeView from "../views/HomeView.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: '/playList',
    name: 'playList',
    component: () => import('../views/PlayList.vue'),
    children: [
      {
        path: 'Chinese',
        component: () => import('../views/Chinese.vue')
      },
      {
        path: 'Pop',
        component: () => import('../views/Pop.vue')
      },
      {
        path: 'Rock',
        component: () => import('../views/Rock.vue')
      },
      {
        path: 'Folk',
        component: () => import('../views/Folk.vue')
      },
      {
        path: 'Electron',
        component: () => import('../views/Electron.vue')
      }
    ]
  },
  {
    path: "/",
    name: "index",
    component: () => import("../views/Index.vue"),
  },
  {
    path: '/musicPlayer',
    name: 'musicPlayer',
    props: true,
    component: () => import('../views/MusicPlayer.vue'),
    meta: {
      title: "音乐播放",
      hideFooter: true,
    },
  },
  {
    path: "/logUserIdea",
    name: "logUserIdea",
    component: () => import("../views/LogUserIdea.vue"),
    meta: {
      title: "登录问卷",
      hideHeader: true,
    },
  },
  {
    path: "/regUserIdea",
    name: "regUserIdea",
    component: () => import("../views/RegUserIdea.vue"),
    meta: {
      title: "注册问卷",
      hideHeader: true,
    },
  },
  {
    path: "/register",
    name: "register",
    component: () => import("../views/Register.vue"),
    meta: {
      title: "注册",
      hideHeader: true,
    },
  },
  {
    path: "/login",
    name: "login",
    component: () => import("../views/Login.vue"),
    meta: {
      title: "登录",
      hideHeader: true,
    },
  },
  {
    path: "/home",
    name: "home",
    component: HomeView,
  },
  {
    path: "/about",
    name: "about",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
